import { http } from "@/utils/http/axios";

export function getList(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "system/dept/list",
			method: "GET",
			params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 根据ID查询
 * @param id
 * @returns
 */
export function getDept(id: number) {
	return http.request<API.Setting.DeptVo>(
		{
			url: `system/dept/${id}`,
			method: "GET"
		},
		{
			isTransformResponse: true
		}
	);
}
/**
 * 删除部门
 * @param id 组织ID
 * @returns
 */
export function remove(id: number) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/dept/" + id,
			method: "DELETE"
		},
		{
			isTransformResponse: false
		}
	);
}

/**
 * 更改部门状态
 * @returns
 */
export function changeStatus(data = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "system/dept/changeStatus",
			method: "put",
			data
		},
		{
			isTransformResponse: true
		}
	);
}

/**
 * 更新数据
 * @returns
 */
export function update(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/dept",
			method: "put",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 添加部门
 * @returns
 */
export function save(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "system/dept",
			method: "post",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
/**
 * 获取部门选择树
 * @returns
 */
export function tree() {
	return http.request<API.Response.BasicResponse>(
		{
			url: "dept/tree",
			method: "get"
		},
		{
			isTransformResponse: false
		}
	);
}
